<?php
/*................................................................
[七行 SevenEL-CMS]
 .  VERSION: 1.0
 .  Author: isrn@qq.com
 .  Support: http://www.sevenel.cn
................................................................*/
/*class relation
* */
class relation {
	const VERSION = 1.0;
	private	$ar=array(
				  9=>array(
						'tid'=>9,
						'icon'=>'attach.png',
						'title'=>'附件库',
						'rightid'=>11,
						'directory'=>'../attach/relation.php?as=1'
						),
				  118=>array(
						'tid'=>118,
						'icon'=>'vcard_key.png',
						'title'=>'公司名片',
						'rightid'=>119,
						'directory'=>'../cardcase/relation.php?as=1'
						),
				  121=>array(
						'tid'=>121,
						'icon'=>'vcard.png',
						'title'=>'个人名片',
						'rightid'=>122,
						'directory'=>'../cardcase/relation.php?as=1'
						),
				  134=>array(
						'tid'=>134,
						'icon'=>'attach.png',
						'title'=>'相关评论',
						'rightid'=>134,
						'directory'=>'../project/leaveMessage.php?as=1'
						),
				   133=>array(
						'tid'=>133,
						'icon'=>'attach.png',
						'title'=>'相关评论',
						'rightid'=>135,
						'directory'=>'../project/leaveMessage.php?as=1'
						)	
				  );
	private $new_link;
	function __construct(){
		
	}
	function __destruct(){
			
	}

	function show($tids=array(),$atid,$aid){
		global $d_sevenel;
			foreach ($tids as $tid){
				switch($tid){
					case 118:{
						
			$sql="SELECT COUNT( id ) as num FROM se_company where tid='118' and  del!=1  and userid like '".$_SESSION['userinfo']['id']."'  and cardcase ='".$aid."'   ";
			$result=$d_sevenel->Dqsql($sql);	
			//echo $sql;
				$str.="<span style='color:black; font-size: 20px; ' >".$result[0]['num']."</span><img   ext:qtip='".$this->ar[$tid]['title']."'  boder='0' src='../img/".$this->ar[$tid]['icon']."'>";
				break;
						}
					case 121:{
						
			$sql="SELECT COUNT(*) as num FROM se_client where tid='121' and  del!=1  and userid like '".$_SESSION['userinfo']['id']."' and cardcase ='".$aid."'  ";
			$result=$d_sevenel->Dqsql($sql);	
			//echo $sql;
				$str.="<span style='color:black; font-size: 20px; ' >".$result[0]['num']."</span><img   ext:qtip='".$this->ar[$tid]['title']."'  boder='0' src='../img/".$this->ar[$tid]['icon']."'>";
				break;
						}
					case 134:{
						
						$sql="SELECT COUNT(*) as num FROM se_info where tid='134' and  del!=1 and input1='".$aid."'";
						$result=$d_sevenel->Dqsql($sql);	
			//echo $sql;
				$str.="<a href='#' onclick=\"relation(".$atid.",".$aid.",".$tid.",'".$this->ar[$tid]['title']."','".$this->ar[$tid]['directory']."');\"><span style='color:black; font-size: 20px; ' >".$result[0]['num']."</span><img   ext:qtip='".$this->ar[$tid]['title']."'  boder='0' src='../img/".$this->ar[$tid]['icon']."'></a>";
				break;
						}
					default:{
						
				//echo $_SESSION['rcg']['a'][$this->ar[$tid]['rightid']];
				if($_SESSION['rcg']=='A' or $_SESSION['rcg']['a'][$this->ar[$tid]['rightid']]==1 or $_SESSION['rcg']['e'][$this->ar[$tid]['rightid']]==1 ){
				 $righte='';
				}else{
				 $righte=" and userid like '".$_SESSION['userinfo']['id']."' ";
					}

			$sql="SELECT COUNT( DISTINCT aid,atid,bid,btid ) as num FROM se_relation where aid='".$aid."'  and  atid='".$atid."' and  btid='".$tid."'    ".$righte."";
			$result=$d_sevenel->Dqsql($sql);	
			//echo $sql;
				$str.="<a href='#' onclick=\"relation(".$atid.",".$aid.",".$tid.",'".$this->ar[$tid]['title']."','".$this->ar[$tid]['directory']."');\"><span style='color:black; font-size: 20px; ' >".$result[0]['num']."</span><img   ext:qtip='".$this->ar[$tid]['title']."'  boder='0' src='../img/".$this->ar[$tid]['icon']."'></a>";
				
				
				break;
						}
					}
				} 
			return $str;
		}
}

//$relation = new relation();

//$temp=$relation->show(array(9));
//echo $temp;
?>
